<?PHP
	class URI {
		var $host;
		var $port;
		var $user;
		var $pass;
		var $protocol;
		var $path;
		var $uri;
		var $uriPatern = '/
				^([a-z0-9\.]*?) # Protocol
				:\/\/
				([a-z0-9\.]+?) # user
				:
				([a-z0-9\.]+?) # password
				@
				([a-z0-9\.]*?) # host
				:
				([0-9]*?) # port
				\/
				([a-z0-9\.]*?) # path
				$
				/x';
		function URI($uri){
			$this->uri = $uri;
			//$totest = "mysql://root@localhost:3306/intranetl4a";
			$this->parse();
		}
		function parse(){
			preg_match($this->uriPatern, $this->uri, $match);
			$this->protocol = $match[1];
			$this->username = $match[2];
			$this->password = $match[3];
			$this->host = $match[4];
			$this->port = $match[5];
			$this->path = $match[6];
		}
	}
?>